package com.bear.atlassianmcp.jira.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

import java.time.Duration;

/**
 * Jira集成配置类
 * 负责配置Jira连接参数和HTTP客户端
 */
@Configuration
public class JiraConfig {

    /**
     * 配置RestTemplate用于Jira API调用
     */
    @Bean("jiraRestTemplate")
    public RestTemplate jiraRestTemplate() {
        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        factory.setConnectTimeout((int) Duration.ofSeconds(30).toMillis());
        factory.setReadTimeout((int) Duration.ofSeconds(60).toMillis());
        
        return new RestTemplate(factory);
    }
}
